import { useContext } from "react";
import { globalContext, globalDispatchContext } from "../redux";

/**
 * @description useRedux
 * @returns {{state:{count:number}|null,dispatch:((type:string,payload:any)=>void)|null}}
 */
export const useRedux = () => {
  const state = useContext(globalContext);
  const dispatch = useContext(globalDispatchContext);
  return {
    state,
    dispatch,
  };
};
